package com.HomeWorkhsp.Chapter08;

import java.util.Scanner;

/**
 * Enjoy programming!!!
 * Time: 2021/11/14 -  15:22
 */
public class HelloIEDA {
    //运行：alt + r
    //main + 回车，会出现下面一行，这是模板，在file->setting->live templates查看
    public static void main(String[] args) {
        //new Scanner后加.var 回车，
        Scanner in = new Scanner(System.in);
        //sout模板：
        System.out.println("Hello IDEA!!");
        Person p = new Person("laowang", 35);
        p.Print();
        //光标放在方法名上，ctrl + b：快速跳到方法

    }
}

//查看继承关系：ctrl + h
class Person {
    String name;
    int age;
    int[] a = {3, 5, 99, 89, 8, 34, 400, 80};

    //快速生成构造器：alt + fn + insert
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void Print() {
        int temp = 0;
        System.out.println("你好，IDEA！！");
        for (int i = 0; i < a.length - 1 ; i++) {//冒泡排序
            for (int j = 0; j <= i; j++) {
                if (a[j] > a[j + 1]){
                    temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i] + " " + i);
        }
        System.out.println(a.length);
    }
}


